<template>
    <el-pagination
        background
        layout="total, prev, pager, next, sizes"
        :total="Pagination.total"
        :page-sizes="[15, 25, 50, 100]"
        :default-page-size="Pagination.pageSizes"
        @current-change="PageFun"
        @size-change="SizeFun"></el-pagination>
</template>

<script lang="ts" setup>
import { ref, reactive } from 'vue';
import bus from '@/utils/bus';

const Props = defineProps<{
    page_total: {
        type: any;
    };
}>();

const Pagination = reactive({
    page: 1,
    pageSizes: 15,
    total: 0
});
const pageInit = () => {
    Pagination.page = 1;
    Pagination.pageSizes = 15;
};
const PageFun = (val: any) => {
    bus.emit('page', val);
};

const SizeFun = (val: any) => {
    bus.emit('size', val);
};

const pageTotal = (val: any) => {
    Pagination.total = val;
};

bus.on('pageTotal', pageTotal);
defineExpose({
    pageInit
});
</script>
